<?php 
include "../conexao.php";

session_start();

if (!isset($_SESSION["txt_login"])) 

{

  	print "<script type = 'text/javascript'> location.href = 'index.php'</script>";

}

 ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	font-size: 14px;
	color:#FFFFFF;
}
-->
</style>
<link href="estilo.css" rel="stylesheet" type="text/css" />
</head>

<body><div id="conteudo"><div align="center">
    <h1><strong><font color="red"><u>Lista de Categorias Prod. Servi&ccedil;os</u></font></strong></h1>
  </div>
<table width="99%" border="0" cellspacing="0" cellpadding="0">
  <tr>
   
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="2" cellpadding="0">
      <tr>
        <td height="22" colspan="3" background="imagens/img_cat.gif"><div align="center" class="style1">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="86%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lista de &nbsp;Categorias                </td>
              <td width="14%" align="center">A&ccedil;&atilde;o</td>
            </tr>
          </table>
        </div></td>
        </tr>
      <tr>
        
        </tr>
      <?php $sql = mysql_query("select * from categoria_servicos");
			  while ($coluna = mysql_fetch_array($sql)) { ?>
      <tr>
        <td width="91%" class="cat"><?php echo $coluna['categoria'] ?> </td>
        <td width="4%" align="center" class="estilo_L"><?php if($_SESSION['txt_login']!=""){?>
        <a href="javascript:abre('frm_categoria_servicos.php?acao=Alterar&amp;id= <?php echo $coluna['id_categoria'];?>','GET')">
        <img src="imagens/alterar.gif" width="16" height="16" border="0" /></a><?php }else{echo "<img src=imagens/alterar.gif onclick=confirmar_exclusao_cat_editar()>";}?>
        </td>
        <td width="5%" align="center" class="estilo_L"><?php if($_SESSION['txt_login']!=""){?>
        <a href="javascript:abre('frm_categoria_servicos.php?acao=Excluir&amp;id= <?php echo $coluna['id_categoria'];?>','GET')">
        <img src="imagens/excluir.gif" width="16" height="16" border="0" /></a><?php }else{echo "<img src=imagens/excluir.gif onclick=confirmar_exclusao_cat()>";}?>
        </td>
      </tr>
      <?php } ?>
      <tr>
        <td colspan="2"><div align="right"> <a href="principal.php?link=3"></a></div></td>
        <td class="estilo_L">
        <?php if(isset($_SESSION["txt_login"])){?>
        
        <a href="javascript:abre('frm_categoria_servicos.php?acao=Inserir&amp;id=<?php echo $coluna['id_categoria'];?>','GET')">
        
        <img src="imagens/inserir.gif" alt="inserir" width="55" height="16" border = "0"/></a><?php }else{?>
        
        <img src="imagens/inserir.gif" alt="inserir" width="55" height="16" border = "0" onclick="alert('somente o administrador pode inserir categorias');"/>
       <?php }?>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table></div>
</body>
</html>
